<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>判断单击还是双击</title>
        <script language="JavaScript">
            document.addEventListener("dbclick", function(){
                document.getElementById("showdbclick1".innerHTML = "双击");
            });
            <!-- document.addEventListener("dbclick",showdbclick);
            function showdbclick(){
                document.getElementById("showdbclick2").innerHTML = "???";
            } -->
        </script>
    </head>
    <body>
        <button>nihao</button>
        <p id="showdbclick1"></p>
        <!-- <p id="showdbclick2"></p> -->
    </body>
</html>